<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GdkPixbuf 结构(The GdkPixbuf Structure)</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK-PixBuf 库参考手册">
<link rel="up" href="rn01.html" title="API 参考">
<link rel="prev" href="gdk-pixbuf-Versioning.html" title="初始化和版本 (Initialization and Versions)">
<link rel="next" href="gdk-pixbuf-refcounting.html" title="引用计数和内存管理 (Reference Counting and Memory Mangement)">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-Versioning.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK-PixBuf 库参考手册</th>
<td><a accesskey="n" href="gdk-pixbuf-refcounting.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-pixbuf-gdk-pixbuf.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk-pixbuf-gdk-pixbuf.description" class="shortcut">Description</a>
                   | 
                  <a href="#gdk-pixbuf-gdk-pixbuf.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#gdk-pixbuf-gdk-pixbuf.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
                   | 
                  <a href="#gdk-pixbuf-gdk-pixbuf.properties" class="shortcut">Properties</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk-pixbuf-gdk-pixbuf"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-pixbuf-gdk-pixbuf.top_of_page"></a>GdkPixbuf 结构(The GdkPixbuf Structure)</span></h2>
<p>GdkPixbuf 结构(The GdkPixbuf Structure) — 描述一个图像的信息。</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-pixbuf-gdk-pixbuf.synopsis"></a><h2>Synopsis</h2>
<a name="GdkPixbuf"></a><pre class="synopsis">
#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;

enum                <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbufError" title="enum GdkPixbufError">GdkPixbufError</a>;
#define             <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR">GDK_PIXBUF_ERROR</a>
enum                <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkColorspace" title="enum GdkColorspace">GdkColorspace</a>;
enum                <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbufAlphaMode" title="enum GdkPixbufAlphaMode">GdkPixbufAlphaMode</a>;
                    <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf-struct" title="GdkPixbuf">GdkPixbuf</a>;
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkColorspace" title="enum GdkColorspace"><span class="returnvalue">GdkColorspace</span></a>       <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-colorspace" title="gdk_pixbuf_get_colorspace ()">gdk_pixbuf_get_colorspace</a>           (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-n-channels" title="gdk_pixbuf_get_n_channels ()">gdk_pixbuf_get_n_channels</a>           (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-has-alpha" title="gdk_pixbuf_get_has_alpha ()">gdk_pixbuf_get_has_alpha</a>            (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-bits-per-sample" title="gdk_pixbuf_get_bits_per_sample ()">gdk_pixbuf_get_bits_per_sample</a>      (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
<a href="../glib/glib-Basic-Types.html#guchar"><span class="returnvalue">guchar</span></a> *            <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-pixels" title="gdk_pixbuf_get_pixels ()">gdk_pixbuf_get_pixels</a>               (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-width" title="gdk_pixbuf_get_width ()">gdk_pixbuf_get_width</a>                (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-height" title="gdk_pixbuf_get_height ()">gdk_pixbuf_get_height</a>               (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-rowstride" title="gdk_pixbuf_get_rowstride ()">gdk_pixbuf_get_rowstride</a>            (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);
const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-option" title="gdk_pixbuf_get_option ()">gdk_pixbuf_get_option</a>               (<em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-gdk-pixbuf.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  <a href="../gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----GdkPixbuf
</pre>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-gdk-pixbuf.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GdkPixbuf implements
 <a href="../gio/GIcon.html">GIcon</a>.</p>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-gdk-pixbuf.properties"></a><h2>Properties</h2>
<pre class="synopsis">
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--bits-per-sample" title='The "bits-per-sample" property'>bits-per-sample</a>"          <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--colorspace" title='The "colorspace" property'>colorspace</a>"               <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkColorspace" title="enum GdkColorspace"><span class="type">GdkColorspace</span></a>         : Read / Write / Construct Only
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--has-alpha" title='The "has-alpha" property'>has-alpha</a>"                <a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct Only
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--height" title='The "height" property'>height</a>"                   <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--n-channels" title='The "n-channels" property'>n-channels</a>"               <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--pixels" title='The "pixels" property'>pixels</a>"                   <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>              : Read / Write / Construct Only
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--rowstride" title='The "rowstride" property'>rowstride</a>"                <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only
  "<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf--width" title='The "width" property'>width</a>"                    <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only
</pre>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-gdk-pixbuf.description"></a><h2>Description</h2>
<p>
    <span class="structname">GdkPixbuf</span> 结构包含用来在内存中描述一个
    图像的信息。
  </p>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="image-data"></a>图像数据</h2></div></div></div>
<p>
      在内存中是以一种不压缩的填充格式保存图像数据的。图像是从顶部到底部一行一行
      的存储的，且每一行的像素又是按从左到右的顺序储存的。在每行的末尾可能会有
      一些补白(padding)。一个 pixbuf 的 "rowstride" 值表示了每行的字节数，
      该值可以通过 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#gdk-pixbuf-get-rowstride" title="gdk_pixbuf_get_rowstride ()"><code class="function">gdk_pixbuf_get_rowstride()</code></a> 函数获得。
    </p>
<div class="example">
<a name="put-pixel"></a><p class="title"><b>Example 1. put_pixel() example</b></p>
<div class="example-contents">
<p>
        下面的代码举了一个适用于每通道8位带一个alpha通道的RGB pixbuf 简单的
	put_pixel()函数的例子。由于性能原因，该函数没有被包含在
	<span class="application">gdk-pixbuf</span> 库；与其为每个像素调用几个函数，你自己的代码可能更便捷。
      </p>
<pre class="programlisting">
static void
put_pixel (GdkPixbuf *pixbuf, int x, int y, guchar red, guchar green, guchar blue, guchar alpha)
{
  int width, height, rowstride, n_channels;
  guchar *pixels, *p;
  n_channels = gdk_pixbuf_get_n_channels (pixbuf);
  g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
  g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
  g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
  g_assert (n_channels == 4);
  width = gdk_pixbuf_get_width (pixbuf);
  height = gdk_pixbuf_get_height (pixbuf);
  g_assert (x &gt;= 0 &amp;&amp; x &lt; width);
  g_assert (y &gt;= 0 &amp;&amp; y &lt; height);
  rowstride = gdk_pixbuf_get_rowstride (pixbuf);
  pixels = gdk_pixbuf_get_pixels (pixbuf);
  p = pixels + y * rowstride + x * n_channels;
  p[0] = red;
  p[1] = green;
  p[2] = blue;
  p[3] = alpha;
}
      </pre>
<p>
        这个函数不适用于非 8bits/sample 或 8位每通道的图像，但他适用于 GTK+
	使用的大多数 pixbuf。
      </p>
</div>
</div>
<br class="example-break"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
        如果使用 <code class="function">memcpy()</code> 处理原始 pixbuf 数据，注意 pixbuf 的最后一行可能
	和行跨度(rowstride)不一样宽，而只是图像数据需要的宽度。也就是说，使用
	<code class="literal">memcpy (dest, pixels, rowstride * height)</code>
	来拷贝整个 pixbuf 是不安全的。用 <a class="link" href="gdk-pixbuf-creating.html#gdk-pixbuf-copy" title="gdk_pixbuf_copy ()"><code class="function">gdk_pixbuf_copy()</code></a> 来取代，或者使用
	<code class="literal">width * ((n_channels * bits_per_sample + 7) / 8)</code>
	计算最后一行以字节为单位的宽度(compute the width in bytes
	of the last row as <code class="literal">width * ((n_channels *
	bits_per_sample + 7) / 8)</code>)。
      </p>
</div>
</div>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-gdk-pixbuf.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdkPixbufError"></a><h3>enum GdkPixbufError</h3>
<pre class="programlisting">typedef enum {
        /* image data hosed */
        GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
        /* no mem to load image */
        GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
        /* bad option passed to save routine */
        GDK_PIXBUF_ERROR_BAD_OPTION,
        /* unsupported image type (sort of an ENOSYS) */
        GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
        /* unsupported operation (load, save) for image type */
        GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
        GDK_PIXBUF_ERROR_FAILED
} GdkPixbufError;
</pre>
<p>
在 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> 域内的一个错误代码。许多 <span class="application">gdk-pixbuf</span> 的操作都会
引起这个域的错误，或者是 <a href="../glib/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> 域的错误。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GDK-PIXBUF-ERROR-CORRUPT-IMAGE:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ERROR_CORRUPT_IMAGE</code></span></p></td>
<td>图像文件不明原因的损坏。
</td>
</tr>
<tr>
<td><p><a name="GDK-PIXBUF-ERROR-INSUFFICIENT-MEMORY:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY</code></span></p></td>
<td>内存不足。
</td>
</tr>
<tr>
<td><p><a name="GDK-PIXBUF-ERROR-BAD-OPTION:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ERROR_BAD_OPTION</code></span></p></td>
<td>向 pixbuf 保存模块传递了一个非法的选项。
</td>
</tr>
<tr>
<td><p><a name="GDK-PIXBUF-ERROR-UNKNOWN-TYPE:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ERROR_UNKNOWN_TYPE</code></span></p></td>
<td>未知的图像类型。
</td>
</tr>
<tr>
<td><p><a name="GDK-PIXBUF-ERROR-UNSUPPORTED-OPERATION:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION</code></span></p></td>
<td>不知道怎么在这种类型的图像上处理给定的操作。
</td>
</tr>
<tr>
<td><p><a name="GDK-PIXBUF-ERROR-FAILED:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ERROR_FAILED</code></span></p></td>
<td>通用错误代码，发生了一些错误。
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GDK-PIXBUF-ERROR:CAPS"></a><h3>GDK_PIXBUF_ERROR</h3>
<pre class="programlisting">#define GDK_PIXBUF_ERROR gdk_pixbuf_error_quark ()
</pre>
<p>
pixbuf 操作所使用的错误域。表明这个错误代码将出现在 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbufError" title="enum GdkPixbufError"><span class="type">GdkPixbufError</span></a> 枚举类型中。参见
<a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> 来获取更多的关于错误域与错误代码的信息。
</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkColorspace"></a><h3>enum GdkColorspace</h3>
<pre class="programlisting">typedef enum {
	GDK_COLORSPACE_RGB
} GdkColorspace;
</pre>
<p>
    该枚举类型定义了 <span class="application">gdk-pixbuf</span> 库支持的颜色空间(color space)。当前只有 RGB 被支持。
  </p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><a name="GDK-COLORSPACE-RGB:CAPS"></a><span class="term"><code class="literal">GDK_COLORSPACE_RGB</code></span></p></td>
<td>表示一个 红/绿/蓝 组成的颜色空间。
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbufAlphaMode"></a><h3>enum GdkPixbufAlphaMode</h3>
<pre class="programlisting">typedef enum
{
        GDK_PIXBUF_ALPHA_BILEVEL,
        GDK_PIXBUF_ALPHA_FULL
} GdkPixbufAlphaMode;
</pre>
<p>
    这些值可以用来传递给 <code class="function">gdk_pixbuf_render_to_drawable_alpha()</code> 来控制怎么处理
    图像的 alpha 通道。这个函数可以创建一个两层的快速蒙板(mask)(黑的和白的)并在绘制
    图像的时候使用。将来，当 X 窗口系统有了 alpha 通道扩展后，它将能将完全alpha
    (full alpha)合成到任何 drawable。当前只能退回到双层快速蒙板上。
  </p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GDK-PIXBUF-ALPHA-BILEVEL:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ALPHA_BILEVEL</code></span></p></td>
<td>将创建一个双层快速蒙板(黑的和白的)并在绘制图像的时候使用
。不透明度在0.5一下的将被认为是完全透明的，而其他的将被认为是完全透明的。
</td>
</tr>
<tr>
<td><p><a name="GDK-PIXBUF-ALPHA-FULL:CAPS"></a><span class="term"><code class="literal">GDK_PIXBUF_ALPHA_FULL</code></span></p></td>
<td>当前将退回到 <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ALPHA-BILEVEL:CAPS"><span class="type">GDK_PIXBUF_ALPHA_BILEVEL</span></a> 。在将来将做完全
alpha 合成。
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf-struct"></a><h3>GdkPixbuf</h3>
<pre class="programlisting">typedef struct _GdkPixbuf GdkPixbuf;</pre>
<p>
    这个是 <span class="application">gdk-pixbuf</span> 库的主要数据结构。它用来表示图像。它包含图像的像素数据的信息，
    它的颜色空间(color space)，每样本位数(bits per sample)，宽度和长度，还有行跨度
    (一行的开始与下一行开始之间的字节数)。
  </p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-colorspace"></a><h3>gdk_pixbuf_get_colorspace ()</h3>
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkColorspace" title="enum GdkColorspace"><span class="returnvalue">GdkColorspace</span></a>       gdk_pixbuf_get_colorspace           (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
获取 pixbuf 的色域
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>色域</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-n-channels"></a><h3>gdk_pixbuf_get_n_channels ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 gdk_pixbuf_get_n_channels           (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
查询pixbuf 的通道数.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>通道数.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-has-alpha"></a><h3>gdk_pixbuf_get_has_alpha ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_pixbuf_get_has_alpha            (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
查询 pixbuf 是否有 alpha 通道（不透明信息）
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>含有 alpha 通道时返回 <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>，否则返回 <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-bits-per-sample"></a><h3>gdk_pixbuf_get_bits_per_sample ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 gdk_pixbuf_get_bits_per_sample      (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
查询 pixbuf 的文件样本位数.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>每个颜色样本的位数。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-pixels"></a><h3>gdk_pixbuf_get_pixels ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#guchar"><span class="returnvalue">guchar</span></a> *            gdk_pixbuf_get_pixels               (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
查询一个指向一个 pixbuf 的一个像素数据的指针。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>一个指向这个 pixbuf 的像素数据的指针。
参见 <a class="xref" href="gdk-pixbuf-gdk-pixbuf.html#image-data" title="图像数据">the section called “图像数据”</a> 了解像素数据在内存中储存的详细信息。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-width"></a><h3>gdk_pixbuf_get_width ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 gdk_pixbuf_get_width                (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
查询 pixbuf 的宽度
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>像素宽度</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-height"></a><h3>gdk_pixbuf_get_height ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 gdk_pixbuf_get_height               (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
查询 pixbuf 的高度
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>像素高度</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-rowstride"></a><h3>gdk_pixbuf_get_rowstride ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 gdk_pixbuf_get_rowstride            (<em class="parameter"><code>const <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>);</pre>
<p>
查询一个 pixbuf 的 rowstride，即一行开始到下一行开始的字节数。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>一个 pixbuf.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>行首之间的距离。</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-pixbuf-get-option"></a><h3>gdk_pixbuf_get_option ()</h3>
<pre class="programlisting">const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       gdk_pixbuf_get_option               (<em class="parameter"><code><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *key</code></em>);</pre>
<p>
Looks up <em class="parameter"><code>key</code></em> in the list of options that may have been attached to the
<em class="parameter"><code>pixbuf</code></em> when it was loaded, or that may have been attached by another
function using <a class="link" href="gdk-pixbuf-Module-Interface.html#gdk-pixbuf-set-option" title="gdk_pixbuf_set_option ()"><code class="function">gdk_pixbuf_set_option()</code></a>.
</p>
<p>
For instance, the ANI loader provides "Title" and "Artist" options. 
The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot 
options for cursor definitions. The PNG loader provides the tEXt ancillary
chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
return an "orientation" option string that corresponds to the embedded 
TIFF/Exif orientation tag (if present).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
<td>非结束字符串</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<em class="parameter"><code>key</code></em> 对应的值。是一个无需释放的以空值结尾的字符串，当无法找到
<em class="parameter"><code>key</code></em> 键时返回 <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>。</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1">
<a name="gdk-pixbuf-gdk-pixbuf.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GdkPixbuf--bits-per-sample"></a><h3>The <code class="literal">"bits-per-sample"</code> property</h3>
<pre class="programlisting">  "bits-per-sample"          <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only</pre>
<p>
文件样本位数。现在只能支持 8 位的文件样本位数.
</p>
<p>Allowed values: [1,16]</p>
<p>Default value: 8</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf--colorspace"></a><h3>The <code class="literal">"colorspace"</code> property</h3>
<pre class="programlisting">  "colorspace"               <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkColorspace" title="enum GdkColorspace"><span class="type">GdkColorspace</span></a>         : Read / Write / Construct Only</pre>
<p>The colorspace in which the samples are interpreted.</p>
<p>Default value: GDK_COLORSPACE_RGB</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf--has-alpha"></a><h3>The <code class="literal">"has-alpha"</code> property</h3>
<pre class="programlisting">  "has-alpha"                <a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct Only</pre>
<p>Whether the pixbuf has an alpha channel.</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf--height"></a><h3>The <code class="literal">"height"</code> property</h3>
<pre class="programlisting">  "height"                   <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only</pre>
<p>The number of rows of the pixbuf.</p>
<p>Allowed values: &gt;= 1</p>
<p>Default value: 1</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf--n-channels"></a><h3>The <code class="literal">"n-channels"</code> property</h3>
<pre class="programlisting">  "n-channels"               <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only</pre>
<p>
一个像素的样本数(samples)。当前，只支持3或者4样本每像素(samples per pixel)。
</p>
<p>Allowed values: &gt;= 0</p>
<p>Default value: 3</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf--pixels"></a><h3>The <code class="literal">"pixels"</code> property</h3>
<pre class="programlisting">  "pixels"                   <a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>              : Read / Write / Construct Only</pre>
<p>A pointer to the pixel data of the pixbuf.</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf--rowstride"></a><h3>The <code class="literal">"rowstride"</code> property</h3>
<pre class="programlisting">  "rowstride"                <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only</pre>
<p>
一行的开始到下一行开始的字节数。该数值(显然)至少要比每行的像素数大。
</p>
<p>Allowed values: &gt;= 1</p>
<p>Default value: 1</p>
</div>
<hr>
<div class="refsect2">
<a name="GdkPixbuf--width"></a><h3>The <code class="literal">"width"</code> property</h3>
<pre class="programlisting">  "width"                    <a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write / Construct Only</pre>
<p>The number of columns of the pixbuf.</p>
<p>Allowed values: &gt;= 1</p>
<p>Default value: 1</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>